package com.wenjiandaorudaochu.demo.controller;

import com.baomidou.mybatisplus.extension.api.R;
import com.wenjiandaorudaochu.demo.service.UserService;
import com.wenjiandaorudaochu.demo.service.impl.UserServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * Created with IntelliJ IDEA
 *
 * @author liumao
 * @date 2023/4/3/003
 */
@Api(value = "用户操作")
@RestController
public class UserController {
    @Autowired
    private UserService userService;

    @ApiOperation(value = "导入用户数据")
    @GetMapping("insert_excel")
    public R insertExcel() throws IOException {
        return R.ok(userService.insertExcel());
    }

    @ApiOperation(value = "获取用户信息")
    @GetMapping("get_user_info")
    public R getUserInfo(String id) {
        return R.ok(userService.getUserInfo(id));
    }

    public static void main(String[] args) {
        //获取当前类的对象
        UserController userController = new UserController();
        try {
            userController.insertExcel();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}